<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>${(metadata.alias)!}</title>
        <@tools.includePlace path="/common/8ddab9ba-a8aa-4745-86c6-66bf1c2c976c.html"/> <#-- header -->
    </head>
    <body>
        <@tools.includePlace path="/common/c32a4f4a-ff5d-49cf-bb59-5d9784539174.html"/> <#-- 导航 -->

        <div class="banner-l3 position-relative d-flex align-items-center justify-content-center" style="background:#22407c url(${site.sitePath}assets/img/banner-l3-bg-1.png) 50% 50% no-repeat;">
            <div class="container text-center position-relative py-3 py-md-4 text-white">
                <div class="breadcrumbs fs-7 text-white d-inline-flex align-items-center text-opacity-50">
                    <a href="${site.sitePath}">首页</a>
                    &gt; <a href="${site.dynamicPath}member/account.html" data-id="member">${(metadata.alias)!}</a>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row gx-5 justify-content-between my-5">
                <@tools.includePlace path="/c936c718-5f19-426f-b3ff-13a5a8d63044.html"/> <#-- 个人中心导航 -->
                <div class="col-md-9">
                    <div class="ps-4">
                        <@trade.account id=user.id>
                        <h3>我的账户</h3>
                        <p><label class="text-secondary">余额:</label>${object.amount}<label class="ms-5 text-secondary">更新日期:</label>${object.updateDate!}</p>
                        <form action="${site.dynamicPath}tradeAccount/recharge" method="post">
                            <input type="hidden" name="_csrf" value="<@tools.csrfToken/>"/>
                            <input type="hidden" name="returnUrl" value="${site.dynamicPath}member/account.html"/>
                            <p>
								<label class="text-secondary">充值:</label>
								<input type="text" name="change" min="0.01" required="required"/>
							</p>
							<p>
								<label  class="text-secondary">付款方式:</label>
								<label class="ms-2"><input type="radio" name="accountType" value="alipay"/>支付宝</label>
								<label class="ms-2"><input type="radio" name="accountType" value="wechat"/>微信</label>
								<input type="submit" class="ms-2 btn btn-primary" value="支付"/>
							</p>
                        </form>
                        </@trade.account>
                        <#macro message code>${springMacroRequestContext.getMessage(code)}</#macro>
                        <#macro merge name value><#if !.vars[name]??><@"<#assign ${name}=''>"?interpret /></#if><#if value??><@"<#assign ${name}=${name}+'${value},'>"?interpret /></#if></#macro>
                        <@trade.accountHistoryList accountId=user.id pageIndex=pageIndex pageSize=10>
                        <h3>我的账户历史</h3>
                        <ul class="article-list">
                            <#list page.list as a>
                            <@merge 'userIds' a.userId!/>
                            </#list>
                            <@sys.user ids=userIds!><#assign userMap=map!/></@sys.user>
                            <#list page.list as a>
                            <li class="card py-2 mb-2 comment">
								<div class="d-flex align-items-center">
									<figure class="rounded-circle">
										<img alt="${(userMap[a.userId?string].nickname)!}" src="${userMap[a.userId?string].cover!(site.sitePath+'assets/img/logo-graphic.png')}">
									</figure>
									<div>
										<a href="${site.dynamicPath}member/user.html?id=${a.userId}" class="fw-bold me-2">${(userMap[a.userId?string].nickname)!}</a><span><#if userMap[a.userId?string].superuser>[管理员]</#if></span>
										<div class="text-secondary text-opacity-50 fs-8">${a.createDate!} </div>
									</div>
								</div>
                                <p>
									<label class="ms-4 text-secondary"><@message 'page.status.accountHistory.'+a.status/>:</label>${a.amountChange!}
									<label class="ms-4 text-secondary">原始金额:</label>${a.amount!}
									<label class="ms-4 text-secondary">余额:</label>${a.balance!}
									<#if a.description?has_content><label class="ms-4 text-secondary">描述:</label>${a.description!}</#if>
								</p>
                            </li>
                            </#list>
                        </ul>
                        <ul class="pagination mt-5 overflow-auto pb-3">
                            <#assign
							url='account.html'
                            start=1
                            end=page.totalPage
                            />
                            <#if (page.pageIndex-5) gt start>
                            <#assign start=page.pageIndex-4/>
                            </#if>
                            <#if (page.pageIndex+5) lt end>
                            <#assign end=page.pageIndex+4/>
                            </#if>
                            <li class="page-item">
								<a class="page-link" href="${getPage(url,page.prePage,'pageIndex')}" aria-label="Previous">
									<span aria-hidden="true">«</span>
								</a>
							</li>
                            <#if start gt 1>
								<li class="page-item"><a class="page-link" href="${getPage(url,1,'pageIndex')}">1</a></li>
								<li class="page-item"><span>...</span></li>
                            </#if>
                            <#list start..end as n>
                            	<li class="page-item<#if n=page.pageIndex> active</#if>"><a class="page-link" href="${getPage(url,n,'pageIndex')}">${n}</a></li>
                            </#list>
                            <#if end lt page.totalPage>
								<li class="page-item"><span>...</span></li>
								<li class="page-item"><a class="page-link" href="${getPage(url,page.totalPage,'pageIndex')}">${page.totalPage}</a></li>
                            </#if>
                            <li class="page-item">
								<a class="page-link" href="${getPage(url,page.nextPage,'pageIndex')}" aria-label="Next">
									<span aria-hidden="true">»</span>
								</a>
							</li>
                        </ul>
                        </@trade.accountHistoryList>
                    </div>
                </div>
            </div>
		</div>
		<script>
			var itemString="itemType=user&itemId=${user.id}";
			var templatePath='${.current_template_name?keep_after('/')}';
		</script>
		<@tools.includePlace path="/footer/7f8bacb5-30ca-4641-b66f-987d447b1a85.html"/> <#-- footer -->
    </body>
</html>
